<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2024/11/21
  Time: 20:26
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>

<head>
    <meta charset="UTF-8">
    <title>欢迎页面-L-admin1.0</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
    <link rel="shortcut icon" href="${pageContext.request.contextPath}/static/favicon.ico" type="image/x-icon"/>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/font.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/xadmin.css">
    <script src="${pageContext.request.contextPath}/static/js/jquery.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/lib/layui/layui.js"
            charset="utf-8"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/js/xadmin.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>

<body>
<div class="x-body">
    <form action="${pageContext.request.contextPath}/dept/allocationDept.do" method="post"
          class="layui-form layui-form-pane">
        <input type="hidden" name="pageNum" value="${pageNum}">
        <input type="hidden" name="userId" value="${userId}">
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">
                分配部门
            </label>
            <table class="layui-table layui-input-block">
                <tbody>
                <c:forEach var="dept" items="${deptList}">
                    <tr>
                        <td>
                            <input type="radio" name="deptId"
                                   value="${dept.deptId}" ${dept.deptId == user.deptId?'checked':''} lay-skin="primary"
                                   title="${dept.deptName}">
                        </td>
                    </tr>
                </c:forEach>
                </tbody>
            </table>
        </div>
        <div class="layui-form-item layui-form-text">
            <label for="desc" class="layui-form-label">
                描述
            </label>
            <div class="layui-input-block">
                <h2>
                    超级管理员：拥有所有权限
                </h2>
                <h2>
                    供货商：供货商权限
                </h2>
                <h2>
                    生产：生产权限
                </h2>
                <h2>
                    销售：销售权限
                </h2>
                <h2>
                    物流：物流权限
                </h2>
                <h2>
                    采购：采购权限
                </h2>
                <h2>
                    财务：财务权限
                </h2>
                <h2>
                    客户：客户权限
                </h2>
                <h2>
                    仓库：仓库权限
                </h2>
            </div>
        </div>
        <div class="layui-form-item">
            <button type="submit" class="layui-btn" lay-submit="" lay-filter="add">分配</button>
        </div>
    </form>
</div>

<script src="${pageContext.request.contextPath}/static/js/jquery-3.7.1.js"></script>

<script>
    // 部门回显
    $(document).ready(function () {
        var cks = document.getElementsByName("deptId");
        var dept =
            ${dept}
            console.log(dept)
        for (var i = 0; i < cks.length; i++) {

            if (cks[i].value == dept.deptId) {
                cks[i].checked = true;
            }

        }
    })


</script>
</body>

</html>
